;; Tests from wabt: https://github.com/WebAssembly/wabt/tree/master/test/interp
;; Distributed under the terms of the wabt license: https://github.com/WebAssembly/wabt/blob/master/LICENSE
;; Modified for compatibility with WAVM's interpretation of the proposed spec.

(module
  ;; i8x16 shl
  (func (export "i8x16_shl_0") (result v128)
    v128.const i32x4 0xff000001 0xe0000002 0x00000003 0x00000004
    i32.const 3
    i8x16.shl)
  (func (export "i8x16_shl_1") (result v128)
    v128.const i32x4 0xff000001 0xe0000002 0x00000003 0x00000004
    i32.const 11
    i8x16.shl)

  ;; i16x8 shl
  (func (export "i16x8_shl_0") (result v128)
    v128.const i32x4 0xff000071 0xe0000702 0x00000003 0x00000004
    i32.const 3
    i16x8.shl)
  (func (export "i16x8_shl_1") (result v128)
    v128.const i32x4 0xff000071 0xe0000702 0x00000003 0x00000004
    i32.const 19
    i16x8.shl)

  ;; i32x4 shl
  (func (export "i32x4_shl_0") (result v128)
    v128.const i32x4 0xff0ff071 0xe0077702 0xe0004003 0x00002004
    i32.const 3
    i32x4.shl)
  (func (export "i32x4_shl_1") (result v128)
    v128.const i32x4 0xff0ff071 0xe0077702 0xe0004003 0x00002004
    i32.const 35
    i32x4.shl)

  ;; i64x2 shl
  (func (export "i64x2_shl_0") (result v128)
    v128.const i32x4 0xff000055 0xe0000702 0xe0004003 0x00002004
    i32.const 3
    i64x2.shl)
  (func (export "i64x2_shl_1") (result v128)
    v128.const i32x4 0xff000055 0xe0000702 0xe0004003 0x00002004
    i32.const 67
    i64x2.shl)

  ;; i8x16 shr (signed and unsigned)
  (func (export "i8x16_shr_s_0") (result v128)
    v128.const i32x4 0xff00000f 0xe00f7002 0x0f000003 0x000ff004
    i32.const 3
    i8x16.shr_s)
  (func (export "i8x16_shr_s_1") (result v128)
    v128.const i32x4 0xff00000f 0xe00f7002 0x0f000003 0x000ff004
    i32.const 11
    i8x16.shr_s)
  (func (export "i8x16_shr_u_0") (result v128)
    v128.const i32x4 0xff00000f 0xe00f7002 0x0f000003 0x000ff004
    i32.const 3
    i8x16.shr_u)
  (func (export "i8x16_shr_u_1") (result v128)
    v128.const i32x4 0xff00000f 0xe00f7002 0x0f000003 0x000ff004
    i32.const 11
    i8x16.shr_u)

  ;; i16x8 shr (signed and unsigned)
  (func (export "i16x8_shr_s_0") (result v128)
    v128.const i32x4 0xff00000f 0xe00f7002 0x0f000003 0x000ff004
    i32.const 3
    i16x8.shr_s)
  (func (export "i16x8_shr_s_1") (result v128)
    v128.const i32x4 0xff00000f 0xe00f7002 0x0f000003 0x000ff004
    i32.const 19
    i16x8.shr_s)
  (func (export "i16x8_shr_u_0") (result v128)
    v128.const i32x4 0xff00000f 0xe00f7002 0x0f000003 0x000ff004
    i32.const 3
    i16x8.shr_u)
  (func (export "i16x8_shr_u_1") (result v128)
    v128.const i32x4 0xff00000f 0xe00f7002 0x0f000003 0x000ff004
    i32.const 19
    i16x8.shr_u)

  ;; i32x4 shr (signed and unsigned)
  (func (export "i32x4_shr_s_0") (result v128)
    v128.const i32x4 0xff00000f 0xe00f7002 0x0f000003 0x000ff004
    i32.const 3
    i32x4.shr_s)
  (func (export "i32x4_shr_s_1") (result v128)
    v128.const i32x4 0xff00000f 0xe00f7002 0x0f000003 0x000ff004
    i32.const 35
    i32x4.shr_s)
  (func (export "i32x4_shr_u_0") (result v128)
    v128.const i32x4 0xff00000f 0xe00f7002 0x0f000003 0x000ff004
    i32.const 3
    i32x4.shr_u)
  (func (export "i32x4_shr_u_1") (result v128)
    v128.const i32x4 0xff00000f 0xe00f7002 0x0f000003 0x000ff004
    i32.const 35
    i32x4.shr_u)

  ;; i64x2 shr (signed and unsigned)
  (func (export "i64x2_shr_s_0") (result v128)
    v128.const i32x4 0xff00000f 0xe00f7002 0x0f000003 0x000ff004
    i32.const 3
    i64x2.shr_s)
  (func (export "i64x2_shr_s_1") (result v128)
    v128.const i32x4 0xff00000f 0xe00f7002 0x0f000003 0x000ff004
    i32.const 67
    i64x2.shr_s)
  (func (export "i64x2_shr_u_0") (result v128)
    v128.const i32x4 0xff00000f 0xe00f7002 0x0f000003 0x000ff004
    i32.const 3
    i64x2.shr_u)
  (func (export "i64x2_shr_u_1") (result v128)
    v128.const i32x4 0xff00000f 0xe00f7002 0x0f000003 0x000ff004
    i32.const 67
    i64x2.shr_u)
)

(assert_return (invoke "i8x16_shl_0") (v128.const i32x4 0xf8000008 0x00000010 0x00000018 0x00000020))
(assert_return (invoke "i8x16_shl_1") (v128.const i32x4 0xf8000008 0x00000010 0x00000018 0x00000020))
(assert_return (invoke "i16x8_shl_0") (v128.const i32x4 0xf8000388 0x00003810 0x00000018 0x00000020))
(assert_return (invoke "i16x8_shl_1") (v128.const i32x4 0xf8000388 0x00003810 0x00000018 0x00000020))
(assert_return (invoke "i32x4_shl_0") (v128.const i32x4 0xf87f8388 0x003bb810 0x00020018 0x00010020))
(assert_return (invoke "i32x4_shl_1") (v128.const i32x4 0xf87f8388 0x003bb810 0x00020018 0x00010020))
(assert_return (invoke "i64x2_shl_0") (v128.const i32x4 0xf80002a8 0x00003817 0x00020018 0x00010027))
(assert_return (invoke "i64x2_shl_1") (v128.const i32x4 0xf80002a8 0x00003817 0x00020018 0x00010027))
(assert_return (invoke "i8x16_shr_s_0") (v128.const i32x4 0xff000001 0xfc010e00 0x01000000 0x0001fe00))
(assert_return (invoke "i8x16_shr_s_1") (v128.const i32x4 0xff000001 0xfc010e00 0x01000000 0x0001fe00))
(assert_return (invoke "i8x16_shr_u_0") (v128.const i32x4 0x1f000001 0x1c010e00 0x01000000 0x00011e00))
(assert_return (invoke "i8x16_shr_u_1") (v128.const i32x4 0x1f000001 0x1c010e00 0x01000000 0x00011e00))
(assert_return (invoke "i16x8_shr_s_0") (v128.const i32x4 0xffe00001 0xfc010e00 0x01e00000 0x0001fe00))
(assert_return (invoke "i16x8_shr_s_1") (v128.const i32x4 0xffe00001 0xfc010e00 0x01e00000 0x0001fe00))
(assert_return (invoke "i16x8_shr_u_0") (v128.const i32x4 0x1fe00001 0x1c010e00 0x01e00000 0x00011e00))
(assert_return (invoke "i16x8_shr_u_1") (v128.const i32x4 0x1fe00001 0x1c010e00 0x01e00000 0x00011e00))
(assert_return (invoke "i32x4_shr_s_0") (v128.const i32x4 0xffe00001 0xfc01ee00 0x01e00000 0x0001fe00))
(assert_return (invoke "i32x4_shr_s_1") (v128.const i32x4 0xffe00001 0xfc01ee00 0x01e00000 0x0001fe00))
(assert_return (invoke "i32x4_shr_u_0") (v128.const i32x4 0x1fe00001 0x1c01ee00 0x01e00000 0x0001fe00))
(assert_return (invoke "i32x4_shr_u_1") (v128.const i32x4 0x1fe00001 0x1c01ee00 0x01e00000 0x0001fe00))
(assert_return (invoke "i64x2_shr_s_0") (v128.const i32x4 0x5fe00001 0xfc01ee00 0x81e00000 0x0001fe00))
(assert_return (invoke "i64x2_shr_s_1") (v128.const i32x4 0x5fe00001 0xfc01ee00 0x81e00000 0x0001fe00))
(assert_return (invoke "i64x2_shr_u_0") (v128.const i32x4 0x5fe00001 0x1c01ee00 0x81e00000 0x0001fe00))
(assert_return (invoke "i64x2_shr_u_1") (v128.const i32x4 0x5fe00001 0x1c01ee00 0x81e00000 0x0001fe00))